﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Shell
</asp:Content>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>Shell</legend>
        <%=Html.TextArea("console", ViewData["console"].ToString(), new {@class = "console", @readonly = "readonly"})%>
        <% using (Ajax.BeginForm("Execute", new AjaxOptions { UpdateTargetId = "console", OnBegin = "console_begin", OnComplete = "console_complete"})) { %>
            <input type="submit" value="Clear" class="runbutton" name="submitButton" />
        <%} %>
    </fieldset>
    <script type="text/javascript">
        $(document).ready(function() {
            var psconsole = $('#console');
            psconsole.scrollTop(
                psconsole[0].scrollHeight - psconsole.height()
            );
        });

        function console_begin() {
            $(".runbutton").attr("disabled", true);
        }

        function console_complete() {
            $(".runbutton").attr("disabled", false);
            $("#command").attr("value", "");
        }
    </script>
</asp:Content>
